package com.hcbd.tdwt.ui.fuda.common.vo.weather;


import com.hcbd.tdwt.MainApp;
import com.hcbd.tdwt.R;


/**
 * - @Description:  天气模式类型
 * - @Author:  LXJ
 * - @Time:  2019/7/31 14:16
 */
public enum WeatherModeType {
    RealTime(0, MainApp.getInstance().getString(R.string.live_weather_forecast)),
    Forecast(1, MainApp.getInstance().getString(R.string.Weather_forecast_for_the_next_3_days)),
    Warning(2, MainApp.getInstance().getString(R.string.disaster_warning)),
    Other(3, MainApp.getInstance().getString(R.string.other));

    //值
    private int value;
    //名称
    private String name;

    WeatherModeType(int v, String n) {
        this.value = v;
        this.name = n;
    }

    /**
     * 根据值获取
     *
     * @param v
     * @return
     */
    public static WeatherModeType get(int v) {
        for (WeatherModeType w : WeatherModeType.values()) {
            if (w.getValue() == v) {
                return w;
            }
        }
        return null;
    }

    /**
     * 根据名称获取
     *
     * @param n
     * @return
     */
    public static WeatherModeType get(String n) {
        for (WeatherModeType w : WeatherModeType.values()) {
            if (w.getName().equals(n)) {
                return w;
            }
        }
        return null;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }}
